const TOKEN_KEY = ''
const USER_KEY = 'currentUser'
const LOGIN_TYPE = 'login_type'

// 获取token
export function getToken() {
	return sessionStorage.getItem(TOKEN_KEY)
}

// 设置token
export function setToken(token) {
	return sessionStorage.setItem(TOKEN_KEY, token)
}

// 获取用户信息
export function getUserData() {
	return JSON.parse(sessionStorage.getItem(USER_KEY))
}

// 设置用户信息
export function setUserData(user) {
	return sessionStorage.setItem(USER_KEY, JSON.stringify(user))
}

// 设置登录类型
export function setLoginType(loginType) {
	return sessionStorage.setItem(LOGIN_TYPE, loginType)
}

// 获取登录类型
export function getLoginType() {
	return sessionStorage.getItem(LOGIN_TYPE)
}

// 删除本地token
export function removeUser() {
	let partnershipCode=JSON.parse(window.sessionStorage.getItem('currentUser')).partnershipCode
	sessionStorage.removeItem(LOGIN_TYPE)
	sessionStorage.removeItem(USER_KEY)
	return partnershipCode
}
